﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace Invoicing.sys
{
    public partial class DeptInfo : Pubs.PageHandle
    {

        private string _deptName = "";

        public string DeptName
        {
            get { return _deptName; }
            set { _deptName = value; }
        }
        private string _province = "";

        public string Province
        {
            get { return _province; }
            set { _province = value; }
        }
        private string _createTime = "";

        public string CreateTime
        {
            get { return _createTime; }
            set { _createTime = value; }
        }

        protected void Page_Load(object sender, EventArgs e)
        {

            //得到当前页的页码
            if (Request["pageNum"] != null)
            {
                CurrentPageindex = int.Parse(Request["pageNum"].ToString());
            }
            DeptInfoBand();


        }

        
        void DeptInfoBand()
        {

            string content = " 1=1 ";

            if (Request["pageNum"]!=null)
            {
                CurrentPageindex = int.Parse(Request["pageNum"].ToString());
            }

            if (Request["deptName"] != null && Request["deptName"] != "")
            {
                content += " and dp_namme like'%"+Request["deptName"]+"%' ";
                DeptName = Request["deptName"].ToString();
            }

            if (Request["dp_createtime"] != null && Request["dp_createtime"] != "")
            {
                content += " and  DATEDIFF(dd,dp_createtime,'" + Request["dp_createtime"] + "')=0 ";
                CreateTime = Request["dp_createtime"].ToString();

            }


           ZY.BLL.ViewDeptInfo dall = new ZY.BLL.ViewDeptInfo();
           TotalCount = dall.GetRecordCount(content);
           DataSet ds = dall.GetListByPage(content, "dp_id desc  ", (CurrentPageindex - 1) * NumPerPage + 1, ((CurrentPageindex - 1) * NumPerPage) + NumPerPage);
           DeptList.DataSource =ds;
           DeptList.DataBind();
           

                
        }
    }
}